package com.laoxu.student.business.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.laoxu.student.business.entity.Student;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.laoxu.student.business.vo.StudentVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 学生 Mapper 接口
 * </p>
 *
 * @author Laoxu
 * @since 2020-04-04
 */
public interface StudentMapper extends BaseMapper<Student> {
    /**
     *
     * @param page 前端传入
     * @return
     */
    @Select("SELECT s.*, g.grade_name, c.class_name,  m.major_name " +
            "FROM tb_student s " +
            "left join tb_grade g on s.grade_id = g.id " +
            "left join tb_class c on s.class_id=c.id " +
            "left join tb_major m on c.major_id=m.id "
    )
    List<StudentVO> selectStudentList(Page page);
}
